Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@nutshelllabs/png-js
Advanced tools
A PNG decoder in JS for the canvas element or Node.js.
This project is a fork of png.js by @devongovett and continued under the scope of this project since it has react-pdf specific features. Any recongnition should go to him and the original project mantainers.
Updated to 977b857a11676c1e720e79ed8d9178a005a9abd6
Simply include png.js and zlib.js on your HTML page, create a canvas element, and call PNG.load to load an image.
<canvas></canvas>
<script src="zlib.js"></script>
<script src="png.js"></script>
<script>
var canvas = document.getElementsByTagName('canvas')[0];
PNG.load('some.png', canvas);
</script>
The source code for the browser version resides in png.js
and also supports loading and displaying animated PNGs.
Install the module using npm
sudo npm install png-js
Require the module and decode a PNG
var PNG = require('png-js');
PNG.decode('some.png', function(pixels) {
// pixels is a 1d array (in rgba order) of decoded pixel data
});
You can also call PNG.load
if you want to load the PNG (but not decode the pixels) synchronously. If you already
have the PNG data in a buffer, simply use new PNG(buffer)
. In both of these cases, you need to call png.decode
yourself which passes your callback the decoded pixels as a buffer. If you already have a buffer you want the pixels
copied to, call copyToImageData
with your buffer and the decoded pixels as returned from decodePixels
.
FAQs
A PNG decoder in JS
We found that @nutshelllabs/png-js demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.